package jzOffer;

public class Num28 {
    public boolean isSymmetric(TreeNode root) {
        if(root==null ) return true;
        return isMirror(root.left,root.right);

    }
    private boolean isMirror(TreeNode rootLeft,TreeNode rootRight){
        if(rootLeft==null && rootRight==null)  return true;
        if(rootLeft==null || rootRight==null)  return false;
        if(rootLeft.val!=rootRight.val) return false;
        return isMirror(rootLeft.left,rootRight.right) && isMirror(rootLeft.right,rootRight.left);

    }
}
